package com.example.klaraservice.controller;

import com.example.klaraservice.pojo.Brand;
import com.example.klaraservice.service.BrandService;
import com.example.klaraservice.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author : Glacialerisa
 * @date : 2023/6/5 14:09
 * @desc :
 */
@Api(tags = "品牌")
@RestController
@RequestMapping("/api/brand")
public class BrandController {
    @Resource
    private BrandService brandService;
    @ApiOperation("获取用户的所有品牌")
    @GetMapping("/getBrand")
    public R getBrand(@RequestParam int id){
        List<Brand> brands = brandService.selectAllBrandByUserId(id);
        if (brands!=null){
            return R.ok().data("brands", brands);
        }
        return R.error();
    }
}
